﻿namespace UnityEditor
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using UnityEditorInternal;
    using UnityEngine;

    internal class GameView : EditorWindow
    {
        private GUIContent gizmosContent = new GUIContent("Gizmos");
        private const string kAspect_16_10_Landscape = "16:10 Landscape";
        private const string kAspect_16_10_Portrait = "16:10 Portrait";
        private const string kAspect_3_2_Landscape = "3:2 Landscape";
        private const string kAspect_3_2_Portrait = "3:2 Portrait";
        private const string kAspect_FWVGA_Landscape = "854x480 (FWVGA Landscape)";
        private const string kAspect_FWVGA_Portrait = "480x854 (FWVGA Portrait)";
        private const string kAspect_HVGA_Landscape = "480x320 (HVGA Landscape)";
        private const string kAspect_HVGA_Portrait = "320x480 (HVGA Portrait)";
        private const string kAspect_iPadTall = "iPad Tall (768x1024)";
        private const string kAspect_iPadTall3_4 = "iPad Tall (3:4)";
        private const string kAspect_iPadWide = "iPad Wide (1024x768)";
        private const string kAspect_iPadWide4_3 = "iPad Wide (4:3)";
        private const string kAspect_iPhone4GTall = "iPhone 4G Tall (640x960)";
        private const string kAspect_iPhone4GWide = "iPhone 4G Wide (960x640)";
        private const string kAspect_iPhone5Tall = "iPhone 5 Tall (9:16)";
        private const string kAspect_iPhone5Wide = "iPhone 5 Wide (16:9)";
        private const string kAspect_iPhoneTall = "iPhone Tall (320x480)";
        private const string kAspect_iPhoneTall2_3 = "iPhone Tall (2:3)";
        private const string kAspect_iPhoneWide = "iPhone Wide (480x320)";
        private const string kAspect_iPhoneWide3_2 = "iPhone Wide (3:2)";
        private const string kAspect_WSVGA_Landscape = "1024x600 (WSVGA Landscape)";
        private const string kAspect_WSVGA_Portrait = "600x1024 (WSVGA Portrait)";
        private const string kAspect_WVGA_Landscape = "800x480 (WVGA Landscape)";
        private const string kAspect_WVGA_Portrait = "480x800 (WVGA Portrait)";
        private const string kAspect_WXGA_Landscape = "1280x800 (WXGA Landscape)";
        private const string kAspect_WXGA_Portrait = "800x1280 (WXGA Portrait)";
        private const string kAspect16_10 = "16:10";
        private const string kAspect16_9 = "16:9";
        private const string kAspect3_2 = "3:2";
        private const string kAspect4_3 = "4:3";
        private const string kAspect5_4 = "5:4";
        private const string kAspectFree = "Free Aspect";
        private const string kAspectPS3_1080p_169 = "1080p (16:9)(1920x1080)";
        private const string kAspectPS3_480p_169 = "480p (16:9)(853x480)";
        private const string kAspectPS3_480p_43 = "480p (4:3)(640x480)";
        private const string kAspectPS3_576p_169 = "576p (16:9)(1024x576)";
        private const string kAspectPS3_576p_43 = "576p (4:3)(720x576)";
        private const string kAspectPS3_720p_169 = "720p (16:9)(1280x720)";
        private const string kAspectStandalone = "Standalone";
        private const string kAspectWeb = "Web";
        private const string kAspectWii16_9 = "Wii (16:9 832x456)";
        private const string kAspectWii4_3 = "Wii (4:3 608x456)";
        private const string kAspectXbox360_720p_169 = "720p (16:9)(1280x720)";
        private const int kBorderSize = 5;
        private const int kHeight = 0x11;
        private const int kNoneSettings = 0;
        private static int kStandaloneSettings;
        private static int kWebSettings;
        [SerializeField]
        private int m_AspectRatio;
        [SerializeField]
        private string m_AspectRatioString = string.Empty;
        [SerializeField]
        private bool m_Gizmos;
        [SerializeField]
        private bool m_MaximizeOnPlay;
        [SerializeField]
        private bool m_Stats;
        private static float[] s_AllViewModeAspects = new float[] { 
            0f, 1.25f, 1.333333f, 1.5f, 1.6f, 1.777778f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0.5625f, 1.777778f, 
            0.6666667f, 1.5f, 0.75f, 1.333333f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0.6666667f, 1.5f, 
            0.625f, 1.6f, 1.333333f, 1.824561f, 0f, 0f, 0f, 0f, 0f, 0f, 0f
         };
        private static string[] s_AllViewModeAspectStrings = new string[] { 
            "Free Aspect", "5:4", "4:3", "3:2", "16:10", "16:9", "Standalone", "Web", "iPhone Tall (320x480)", "iPhone Wide (480x320)", "iPhone 4G Tall (640x960)", "iPhone 4G Wide (960x640)", "iPad Tall (768x1024)", "iPad Wide (1024x768)", "iPhone 5 Tall (9:16)", "iPhone 5 Wide (16:9)", 
            "iPhone Tall (2:3)", "iPhone Wide (3:2)", "iPad Tall (3:4)", "iPad Wide (4:3)", "320x480 (HVGA Portrait)", "480x320 (HVGA Landscape)", "480x800 (WVGA Portrait)", "800x480 (WVGA Landscape)", "480x854 (FWVGA Portrait)", "854x480 (FWVGA Landscape)", "600x1024 (WSVGA Portrait)", "1024x600 (WSVGA Landscape)", "800x1280 (WXGA Portrait)", "1280x800 (WXGA Landscape)", "3:2 Portrait", "3:2 Landscape", 
            "16:10 Portrait", "16:10 Landscape", "Wii (4:3 608x456)", "Wii (16:9 832x456)", "720p (16:9)(1280x720)", "1080p (16:9)(1920x1080)", "720p (16:9)(1280x720)", "576p (4:3)(720x576)", "576p (16:9)(1024x576)", "480p (4:3)(640x480)", "480p (16:9)(853x480)"
         };
        private static Vector2[] s_AllViewModeResolutions = new Vector2[] { 
            Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(320f, 480f), new Vector2(480f, 320f), new Vector2(640f, 960f), new Vector2(960f, 640f), new Vector2(768f, 1024f), new Vector2(1024f, 768f), Vector2.zero, Vector2.zero, 
            Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(320f, 480f), new Vector2(480f, 320f), new Vector2(480f, 800f), new Vector2(800f, 480f), new Vector2(480f, 854f), new Vector2(854f, 480f), new Vector2(600f, 1024f), new Vector2(1024f, 600f), new Vector2(800f, 1280f), new Vector2(1280f, 800f), Vector2.zero, Vector2.zero, 
            Vector2.zero, Vector2.zero, new Vector2(608f, 456f), new Vector2(832f, 456f), new Vector2(1280f, 720f), new Vector2(1920f, 1080f), new Vector2(1280f, 720f), new Vector2(720f, 576f), new Vector2(1024f, 576f), new Vector2(640f, 480f), new Vector2(853f, 480f)
         };
        private static int s_AndroidResoultionFixedFirst;
        private static int s_AndroidResoultionFixedLast;
        private static List<GameView> s_GameViews = new List<GameView>();
        private static GUIStyle s_GizmoButtonStyle;
        private static int s_iPhoneResoultionFixedFirst;
        private static int s_iPhoneResoultionFixedLast;
        private static Vector2 s_MainGameViewSize = new Vector2(-1f, -1f);
        private static int s_PS3ResoultionFixedFirst;
        private static int s_PS3ResoultionFixedLast;
        private static float[] s_viewModeAspects = null;
        private static string[] s_viewModeAspectStrings = null;
        private static Vector2[] s_viewModeResolutions = null;
        private static int s_WiiResolution16x9;
        private static int s_WiiResolution4x3;
        private static int s_Xbox360ResolutionFixedFirst;
        private static int s_Xbox360ResolutionFixedLast;

        public GameView()
        {
            base.depthBufferBits = 0x20;
            base.antiAlias = -1;
            base.autoRepaintOnSceneChange = true;
        }

        private void DoStatusBarGUI()
        {
            GUILayout.BeginHorizontal("toolbar", new GUILayoutOption[0]);
            this.SetupSpecialAspectDisplayNames();
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(130f) };
            int num = EditorGUILayout.Popup(this.m_AspectRatio, s_viewModeAspectStrings, "ToolbarPopup", options);
            if (num != this.m_AspectRatio)
            {
                this.m_AspectRatio = num;
                this.m_AspectRatioString = s_viewModeAspectStrings[this.m_AspectRatio];
                base.dontClearBackground = true;
                GameViewAspectWasChanged();
            }
            GUILayout.FlexibleSpace();
            this.m_MaximizeOnPlay = GUILayout.Toggle(this.m_MaximizeOnPlay, "Maximize on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_Stats = GUILayout.Toggle(this.m_Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Rect position = GUILayoutUtility.GetRect(this.gizmosContent, s_GizmoButtonStyle);
            Rect rect2 = new Rect(position.xMax - s_GizmoButtonStyle.border.right, position.y, (float) s_GizmoButtonStyle.border.right, position.height);
            if (EditorGUI.ButtonMouseDown(rect2, GUIContent.none, FocusType.Passive, GUIStyle.none) && AnnotationWindow.ShowAtPosition(GUILayoutUtility.topLevel.GetLast()))
            {
                GUIUtility.ExitGUI();
            }
            this.m_Gizmos = GUI.Toggle(position, this.m_Gizmos, this.gizmosContent, s_GizmoButtonStyle);
            GUILayout.EndHorizontal();
        }

        private int FindSpecialAspectIndex(string modifiedName)
        {
            for (int i = s_viewModeAspectStrings.Length - 1; i >= 0; i--)
            {
                if (modifiedName.StartsWith(s_viewModeAspectStrings[i]))
                {
                    return i;
                }
            }
            return -1;
        }

        private static void GameViewAspectWasChanged()
        {
            if ((Selection.activeGameObject != null) && (Selection.activeGameObject.GetComponent<Camera>() != null))
            {
                SceneView.RepaintAll();
            }
        }

        internal static void GetGameViewRect(Rect position, int aspectRatio, out Rect entireGameViewRect, out Rect localRect)
        {
            if (s_viewModeAspects == null)
            {
                SetupAspects();
            }
            entireGameViewRect = new Rect(0f, 17f, position.width, position.height - 17f);
            localRect = entireGameViewRect;
            bool flag = true;
            float num = s_viewModeAspects[aspectRatio];
            if (aspectRatio == kStandaloneSettings)
            {
                if ((InternalEditorUtility.defaultScreenHeight > position.height) || (InternalEditorUtility.defaultScreenWidth > position.width))
                {
                    num = InternalEditorUtility.defaultScreenWidth / InternalEditorUtility.defaultScreenHeight;
                }
                else
                {
                    localRect.height = InternalEditorUtility.defaultScreenHeight;
                    localRect.width = InternalEditorUtility.defaultScreenWidth;
                    flag = false;
                }
            }
            else if (aspectRatio == kWebSettings)
            {
                if ((InternalEditorUtility.defaultWebScreenHeight > position.height) || (InternalEditorUtility.defaultWebScreenWidth > position.width))
                {
                    num = InternalEditorUtility.defaultWebScreenWidth / InternalEditorUtility.defaultWebScreenHeight;
                }
                else
                {
                    localRect.height = InternalEditorUtility.defaultWebScreenHeight;
                    localRect.width = InternalEditorUtility.defaultWebScreenWidth;
                    flag = false;
                }
            }
            else if ((((aspectRatio >= s_iPhoneResoultionFixedFirst) && (aspectRatio <= s_iPhoneResoultionFixedLast)) || ((aspectRatio >= s_AndroidResoultionFixedFirst) && (aspectRatio <= s_AndroidResoultionFixedLast))) || ((((aspectRatio >= s_PS3ResoultionFixedFirst) && (aspectRatio <= s_PS3ResoultionFixedLast)) || ((aspectRatio >= s_Xbox360ResolutionFixedFirst) && (aspectRatio <= s_Xbox360ResolutionFixedLast))) || ((aspectRatio == s_WiiResolution4x3) || (aspectRatio == s_WiiResolution16x9))))
            {
                Vector2 vector = s_viewModeResolutions[aspectRatio];
                localRect.width = vector.x;
                localRect.height = vector.y;
                flag = false;
            }
            else if (aspectRatio == 0)
            {
                flag = false;
            }
            if (flag)
            {
                localRect.height = ((localRect.width / num) <= (position.height - 17f)) ? (localRect.width / num) : (position.height - 17f);
                localRect.width = localRect.height * num;
            }
            if (localRect.height > (position.height - 17f))
            {
                localRect.height = position.height - 17f;
            }
            if (localRect.width > position.width)
            {
                localRect.width = position.width;
            }
            localRect.y = (8.5f + (position.height / 2f)) - (localRect.height / 2f);
            localRect.x = (position.width / 2f) - (localRect.width / 2f);
            localRect.y = (localRect.y >= 17f) ? localRect.y : 17f;
            localRect.x = (localRect.x >= 0f) ? localRect.x : 0f;
        }

        internal static GameView GetMainGameView()
        {
            if ((s_GameViews != null) && (s_GameViews.Count > 0))
            {
                return s_GameViews[0];
            }
            return null;
        }

        internal Vector2 GetSize()
        {
            Rect rect;
            Rect rect2;
            base.m_Pos = base.m_Parent.borderSize.Remove(base.m_Parent.position);
            GetGameViewRect(base.m_Pos, this.m_AspectRatio, out rect2, out rect);
            return new Vector2(rect.width, rect.height);
        }

        internal static Vector2 GetSizeOfMainGameView()
        {
            GameView mainGameView = GetMainGameView();
            if (mainGameView != null)
            {
                s_MainGameViewSize = mainGameView.GetSize();
            }
            return s_MainGameViewSize;
        }

        public void InitSize()
        {
            if (base.m_Parent != null)
            {
                Rect rect;
                Rect rect2;
                base.m_Pos = base.m_Parent.borderSize.Remove(base.m_Parent.position);
                GetGameViewRect(base.m_Pos, this.m_AspectRatio, out rect2, out rect);
                base.SetInternalGameViewRect(rect);
            }
        }

        public bool IsShowingGizmos()
        {
            return this.m_Gizmos;
        }

        private void KeepChangingAspectsUpToDate()
        {
            if ((this.m_AspectRatio >= s_viewModeAspectStrings.Length) || (this.m_AspectRatioString != s_viewModeAspectStrings[this.m_AspectRatio]))
            {
                int index;
                if (this.m_AspectRatioString.StartsWith("Standalone") || this.m_AspectRatioString.StartsWith("Web"))
                {
                    index = this.FindSpecialAspectIndex(this.m_AspectRatioString);
                }
                else
                {
                    index = Array.IndexOf<string>(s_viewModeAspectStrings, this.m_AspectRatioString);
                }
                this.m_AspectRatio = (index != -1) ? index : 0;
                this.m_AspectRatioString = s_viewModeAspectStrings[this.m_AspectRatio];
            }
        }

        public void OnDisable()
        {
            s_GameViews.Remove(this);
        }

        public void OnEnable()
        {
            base.dontClearBackground = true;
            s_GameViews.Add(this);
        }

        private void OnFocus()
        {
            InternalEditorUtility.OnGameViewFocus(true);
        }

        private void OnGUI()
        {
            Rect rect;
            Rect rect2;
            if (s_viewModeAspects == null)
            {
                SetupAspects();
            }
            this.KeepChangingAspectsUpToDate();
            if (s_GizmoButtonStyle == null)
            {
                s_GizmoButtonStyle = "GV Gizmo DropDown";
            }
            this.DoStatusBarGUI();
            GetGameViewRect(base.position, this.m_AspectRatio, out rect, out rect2);
            Rect rect3 = GUIClip.Unclip(rect2);
            base.SetInternalGameViewRect(rect3);
            EditorGUIUtility.AddCursorRect(rect2, MouseCursor.CustomCursor);
            EventType type = Event.current.type;
            if ((type == EventType.MouseDown) && rect.Contains(Event.current.mousePosition))
            {
                Unsupported.SetAllowCursorLock(true);
                Unsupported.SetAllowCursorHide(true);
            }
            else if ((type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Escape))
            {
                Unsupported.SetAllowCursorLock(false);
            }
            switch (type)
            {
                case EventType.Layout:
                case EventType.Used:
                    break;

                case EventType.Repaint:
                {
                    if ((this.m_AspectRatio != 0) || !InternalEditorUtility.HasFullscreenCamera())
                    {
                        GUI.Box(rect, GUIContent.none, "GameViewBackground");
                    }
                    GUIUtility.s_EditorScreenPointOffset = Vector2.zero;
                    SavedGUIState state = SavedGUIState.Create();
                    EditorGUIUtility.RenderGameViewCameras(rect3, this.m_Gizmos, true);
                    state.ApplyAndForget();
                    break;
                }
                default:
                {
                    if (((type == EventType.KeyDown) && (Event.current.character == ' ')) && (!EditorApplication.isPlaying || EditorApplication.isPaused))
                    {
                        return;
                    }
                    bool flag = rect2.Contains(Event.current.mousePosition);
                    if ((Event.current.rawType == EventType.MouseDown) && !flag)
                    {
                        return;
                    }
                    Event.current.mousePosition = new Vector2(Event.current.mousePosition.x - rect2.x, Event.current.mousePosition.y - rect2.y);
                    EditorGUIUtility.QueueGameViewInputEvent(Event.current);
                    bool flag2 = true;
                    if ((Event.current.rawType == EventType.MouseUp) && !flag)
                    {
                        flag2 = false;
                    }
                    switch (type)
                    {
                        case EventType.ExecuteCommand:
                        case EventType.ValidateCommand:
                            flag2 = false;
                            break;
                    }
                    if (flag2)
                    {
                        Event.current.Use();
                    }
                    else
                    {
                        Event.current.mousePosition = new Vector2(Event.current.mousePosition.x + rect2.x, Event.current.mousePosition.y + rect2.y);
                    }
                    break;
                }
            }
            if (this.m_Stats)
            {
                GameViewGUI.GameViewStatsGUI();
            }
        }

        private void OnLostFocus()
        {
            if (!EditorApplicationLayout.IsInitializingPlaymodeLayout())
            {
                Unsupported.SetAllowCursorLock(false);
                Unsupported.SetAllowCursorHide(false);
            }
            InternalEditorUtility.OnGameViewFocus(false);
        }

        internal override void OnResized()
        {
            GameViewAspectWasChanged();
        }

        private void OnSelectionChange()
        {
            if (this.m_Gizmos)
            {
                base.Repaint();
            }
        }

        public static void RepaintAll()
        {
            if (s_GameViews != null)
            {
                foreach (GameView view in s_GameViews)
                {
                    view.Repaint();
                }
            }
        }

        private static void SetAspects(params string[] aspects)
        {
            s_viewModeResolutions = new Vector2[aspects.Length];
            s_viewModeAspects = new float[aspects.Length];
            s_viewModeAspectStrings = new string[aspects.Length];
            for (int i = 0; i < aspects.Length; i++)
            {
                int index = Array.IndexOf<string>(s_AllViewModeAspectStrings, aspects[i]);
                if (index == -1)
                {
                    throw new System.Exception("Aspect not found '" + aspects[i] + "'");
                }
                s_viewModeResolutions[i] = s_AllViewModeResolutions[index];
                s_viewModeAspects[i] = s_AllViewModeAspects[index];
                s_viewModeAspectStrings[i] = s_AllViewModeAspectStrings[index];
            }
        }

        private static void SetupAspects()
        {
            switch (BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget))
            {
                case BuildTargetGroup.Standalone:
                {
                    string[] aspects = new string[] { "Free Aspect", "5:4", "4:3", "3:2", "16:10", "16:9", "Standalone" };
                    SetAspects(aspects);
                    break;
                }
                case BuildTargetGroup.WebPlayer:
                case BuildTargetGroup.FlashPlayer:
                {
                    string[] textArray2 = new string[] { "Free Aspect", "5:4", "4:3", "3:2", "16:10", "16:9", "Web" };
                    SetAspects(textArray2);
                    break;
                }
                case BuildTargetGroup.Wii:
                {
                    string[] textArray3 = new string[] { "Free Aspect", "4:3", "16:9", "Wii (4:3 608x456)", "Wii (16:9 832x456)", "4:3", "16:9" };
                    SetAspects(textArray3);
                    break;
                }
                case BuildTargetGroup.iPhone:
                {
                    string[] textArray6 = new string[] { "Free Aspect", "iPhone Tall (320x480)", "iPhone Wide (480x320)", "iPhone 4G Tall (640x960)", "iPhone 4G Wide (960x640)", "iPad Tall (768x1024)", "iPad Wide (1024x768)", "iPhone 5 Tall (9:16)", "iPhone 5 Wide (16:9)", "iPhone Tall (2:3)", "iPhone Wide (3:2)", "iPad Tall (3:4)", "iPad Wide (4:3)" };
                    SetAspects(textArray6);
                    break;
                }
                case BuildTargetGroup.PS3:
                {
                    string[] textArray4 = new string[] { "Free Aspect", "4:3", "16:9", "16:10", "1080p (16:9)(1920x1080)", "720p (16:9)(1280x720)", "576p (4:3)(720x576)", "576p (16:9)(1024x576)", "480p (4:3)(640x480)", "480p (16:9)(853x480)" };
                    SetAspects(textArray4);
                    break;
                }
                case BuildTargetGroup.XBOX360:
                {
                    string[] textArray5 = new string[] { "Free Aspect", "4:3", "16:9", "16:10", "720p (16:9)(1280x720)" };
                    SetAspects(textArray5);
                    break;
                }
                case BuildTargetGroup.Android:
                {
                    string[] textArray7 = new string[] { "Free Aspect", "320x480 (HVGA Portrait)", "480x320 (HVGA Landscape)", "480x800 (WVGA Portrait)", "800x480 (WVGA Landscape)", "480x854 (FWVGA Portrait)", "854x480 (FWVGA Landscape)", "600x1024 (WSVGA Portrait)", "1024x600 (WSVGA Landscape)", "800x1280 (WXGA Portrait)", "1280x800 (WXGA Landscape)", "3:2 Portrait", "3:2 Landscape", "16:10 Portrait", "16:10 Landscape" };
                    SetAspects(textArray7);
                    break;
                }
                default:
                    SetAspects(s_AllViewModeAspectStrings);
                    break;
            }
            kStandaloneSettings = Array.IndexOf<string>(s_viewModeAspectStrings, "Standalone");
            kWebSettings = Array.IndexOf<string>(s_viewModeAspectStrings, "Web");
            s_iPhoneResoultionFixedFirst = Array.IndexOf<string>(s_viewModeAspectStrings, "iPhone Tall (320x480)");
            s_iPhoneResoultionFixedLast = Array.IndexOf<string>(s_viewModeAspectStrings, "iPad Wide (1024x768)");
            s_AndroidResoultionFixedFirst = Array.IndexOf<string>(s_viewModeAspectStrings, "320x480 (HVGA Portrait)");
            s_AndroidResoultionFixedLast = Array.IndexOf<string>(s_viewModeAspectStrings, "1280x800 (WXGA Landscape)");
            s_WiiResolution4x3 = Array.IndexOf<string>(s_viewModeAspectStrings, "Wii (4:3 608x456)");
            s_WiiResolution16x9 = Array.IndexOf<string>(s_viewModeAspectStrings, "Wii (16:9 832x456)");
            s_Xbox360ResolutionFixedFirst = Array.IndexOf<string>(s_viewModeAspectStrings, "720p (16:9)(1280x720)");
            s_Xbox360ResolutionFixedLast = Array.IndexOf<string>(s_viewModeAspectStrings, "720p (16:9)(1280x720)");
            s_PS3ResoultionFixedFirst = Array.IndexOf<string>(s_viewModeAspectStrings, "1080p (16:9)(1920x1080)");
            s_PS3ResoultionFixedLast = Array.IndexOf<string>(s_viewModeAspectStrings, "480p (16:9)(853x480)");
        }

        private void SetupSpecialAspectDisplayNames()
        {
            if (kStandaloneSettings != -1)
            {
                object[] objArray1 = new object[] { "Standalone (", InternalEditorUtility.defaultScreenWidth, "x", InternalEditorUtility.defaultScreenHeight, ")" };
                s_viewModeAspectStrings[kStandaloneSettings] = string.Concat(objArray1);
            }
            if (kWebSettings != -1)
            {
                object[] objArray2 = new object[] { "Web (", InternalEditorUtility.defaultWebScreenWidth, "x", InternalEditorUtility.defaultWebScreenHeight, ")" };
                s_viewModeAspectStrings[kWebSettings] = string.Concat(objArray2);
            }
            if (this.m_AspectRatio != -1)
            {
                if (this.m_AspectRatio == kStandaloneSettings)
                {
                    this.m_AspectRatioString = s_viewModeAspectStrings[kStandaloneSettings];
                }
                else if (this.m_AspectRatio == kWebSettings)
                {
                    this.m_AspectRatioString = s_viewModeAspectStrings[kWebSettings];
                }
            }
        }

        public bool maximizeOnPlay
        {
            get
            {
                return this.m_MaximizeOnPlay;
            }
            set
            {
                this.m_MaximizeOnPlay = value;
            }
        }
    }
}

